//
//  RightPlaceholdTextField.m
//  IYTLCMainProject
//
//  Created by txj on 2017/4/3.
//  Copyright © 2017年 hs. All rights reserved.
//

#import "TRightPlaceholdTextField.h"

@implementation TRightPlaceholdTextField
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}
- (void)drawPlaceholderInRect:(CGRect)rect{
    UIColor *placeholderColor =  [UIColor colorWithRed:118/255.0 green:133/255.0 blue:149/255.0 alpha:1/1.0];//设置颜色
    [placeholderColor setFill];
    
//    CGRect placeholderRect = CGRectMake(rect.origin.x+10, (rect.size.height- self.font.pointSize)/2, rect.size.width, self.font.pointSize);//设置距离
    
    
    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
    style.lineBreakMode = NSLineBreakByTruncatingTail;
    style.alignment = NSTextAlignmentRight;
    NSDictionary *attr = [NSDictionary dictionaryWithObjectsAndKeys:style,NSParagraphStyleAttributeName, self.font, NSFontAttributeName, placeholderColor, NSForegroundColorAttributeName, nil];
    
    [self.placeholder drawInRect:rect withAttributes:attr];
}
@end
